/*
 * DprKeyboard.h
 *
 *  Created on: 2012-11-28
 *      Author: kylin
 */

#ifndef DPRKEYBOARD_H_
#define DPRKEYBOARD_H_

#include <kthread.h>

class DprKeyboard
{
public:
	DprKeyboard(const QString &devNode);
	virtual ~DprKeyboard();

public:
	bool open();
	void close();

	bool readKey(unsigned short &keyCode,unsigned int wait);

private:
	QString m_devNode;
	int m_fd;
};

class KeyboardManager : public kthread
{
	Q_OBJECT
public:
	KeyboardManager(const QString &devNode);
	virtual ~KeyboardManager();

signals:
	void sigKeyEvent(int code);

protected:
	virtual void run();

private:
	DprKeyboard* m_keyboard;
};

#endif /* DPRKEYBOARD_H_ */
